package alittlepond.util;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class LayoutUtils {

	public static JComponent createLabeledComponent(String label, JComponent component) {
		JPanel panel = new JPanel();
		panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
		
		JLabel theLabel = new JLabel(label);
		theLabel.setLabelFor(component);
		
		panel.add(theLabel);
		panel.add(Box.createHorizontalGlue());
		panel.add(component);		
		return panel;
		
	}
	
	
}
